package pl.uz.zgora.plan;

import java.io.UnsupportedEncodingException;

import org.ksoap2.serialization.SoapObject;

public class News {
	private String tresc = null;
	private String link = null;
	
	public News() {}
	
	public News(final SoapObject newsSoapObj) throws UnsupportedEncodingException {

		final String tresc = newsSoapObj.getProperty("tresc").toString();
		final byte[] bytes = tresc.getBytes("ISO-8859-1");
		final String encodedString = new String(bytes, "UTF-8");
		setTresc(encodedString);
		
		final String link = newsSoapObj.getProperty("link").toString();
		setLink(link);
	}

	public News(String tresc, String link) {
		super();
		this.tresc = tresc;
		this.link = link;
	}
	public String getTresc() {
		return tresc;
	}
	public void setTresc(final String tresc) throws IllegalArgumentException {
		if(tresc == null || tresc.equals("")) { throw new IllegalArgumentException(); }
		this.tresc = tresc;
	}
	public String getLink() {
		return link;
	}
	public void setLink(final String link) {
		this.link = link;
	}
}
